//
//  SCAppAppearance.m
//  HX2Car
//
//  Created by Mudmen on 2017/3/2.
//  Copyright © 2017年 Hx2car_mac. All rights reserved.
//

#import "SCAppAppearance.h"

@implementation SCAppAppearance

+ (UIColor*)separatorColor {
  return [UIColor colorWithWhite:209./255. alpha:1];
}

+ (UIColor*)separatorLightColor
{
  return [UIColor colorWithHexString:LIGHT_GRAY_LINE_COLOR];
}

+ (UIColor*)tintColor {
  return [UIColor colorWithRed:1 green:102./255. blue:0 alpha:1];
}

+ (NSDictionary *)textAttributesWithFont:(UIFont *)font textColor:(UIColor *)color{
  NSDictionary *titleArr = @{
    NSFontAttributeName : font,
    NSForegroundColorAttributeName : color,
  };
  
  return titleArr;
}

+ (UIFont *)defaultContentFontWithSize:(CGFloat)fontSize
{
  return [UIFont systemFontOfSize:fontSize];
  //    return [UIFont fontWithName:APP_DEFAULT_CONTENT_FONTNAME size:fontSize];
}

+ (UIFont *)defaultTitleFontWithSize:(CGFloat)fontSize
{
  return [UIFont systemFontOfSize:fontSize];
  //    return [UIFont fontWithName:APP_DEFAULT_TITLE_FONTNAME size:fontSize];
}

+ (UIFont *)boldFontWithSize:(CGFloat)fontSize
{
  return [UIFont boldSystemFontOfSize:fontSize];
}

+ (NSDictionary *)lightNavigationBarTitleAttribute
{
  NSDictionary *navTitleArr = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:NAVIGATIONBAR_FONT],NSFontAttributeName,[UIColor colorWithHexString:DARK_GRAY_COLOR],NSForegroundColorAttributeName,nil];
  return navTitleArr;
}

+ (NSDictionary *)darkNavigationBarTitleAttribute
{
  NSDictionary *navTitleArr = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:NAVIGATIONBAR_FONT],NSFontAttributeName,[UIColor whiteColor],NSForegroundColorAttributeName, nil];
  return navTitleArr;
}

+ (void)loadAppearance {
  
  UIBarButtonItem *barButtonAppearance = [UIBarButtonItem appearance];
  [barButtonAppearance setTitleTextAttributes:@{NSFontAttributeName:[SCAppAppearance defaultContentFontWithSize:15.0f]} forState:UIControlStateNormal];
  
//  UITabBar *tabBarAppearance = [UITabBar appearance];
//  [tabBarAppearance setShadowImage:[UIImage imageNamed:@"tabbar_shadow"]];
//  [tabBarAppearance setBackgroundImage:[[UIImage alloc]init]];
  
  UITableView *tableViewAppearance = [UITableView appearance];
  tableViewAppearance.sectionIndexBackgroundColor = [UIColor clearColor];
  tableViewAppearance.sectionIndexColor = [UIColor colorWithHexString:DARK_GRAY_COLOR];
  
  [[UISwitch appearance] setOnTintColor:[SCAppAppearance tintColor]];
  [UITextField appearance].tintColor = [SCAppAppearance tintColor];
  [UITextView appearance].tintColor = [SCAppAppearance tintColor];
    
  UISegmentedControl *segAppearance = [UISegmentedControl appearance];
  [segAppearance setTintColor:[SCAppAppearance tintColor]];
}

@end
